package main

import (
	"fmt"
	"os"
	"strings"
)

// 样例1
func echo1(isOutput bool) {
	var s, sep string
	for i := 1; i < len(os.Args); i++ {
		s += sep + os.Args[i]
		sep = " "
	}
	if isOutput {
		fmt.Println(s)
	}

}

// 样例2
func echo2(isOutput bool) {
	s, sep := "", ""
	for _, arg := range os.Args[1:] {
		s += sep + arg
		sep = " "
	}
	if isOutput {
		fmt.Println(s)
	}
}

// 样例3
func echo3(isOutput bool) {
	s := strings.Join(os.Args[1:], " ")
	if isOutput {
		fmt.Println(s)
	}
}

// 习题1.1
func exercise_echo1() {
	fmt.Println(strings.Join(os.Args, " "))
}

// 习题1.2
func exercise_echo2() {
	for index, arg := range os.Args[1:] {
		fmt.Println(index, arg)
	}
}

func main() {

	echo1(true)
	echo2(true)
	echo3(true)
	exercise_echo1()
	exercise_echo2()
}
